﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Copy4Backup.Enums;

namespace Copy4Backup
{
	public class ExecuteEventArgs : EventArgs
	{
		

		#region Fields

		#endregion Fields
	
		#region Properties

		public ExecuteEvent Action
		{
			get;
			private set;
		}

		public String FileName
		{
			get;
			set;
		}

		public Disk Disk
		{
			get;
			set;
		}
		#endregion Properties

		#region Methods

		/// <summary>
		/// Prevents the default ctor usage.
		/// </summary>
		private ExecuteEventArgs()
		{
		}

		public ExecuteEventArgs(ExecuteEvent action)
		{
			Action = action;
		}

		#region EventArgs overrided methods

		/// <summary>
		/// Compares the instance with an object.
		/// </summary>
		/// <param name="obj">An object to compare</param>
		/// <returns>True, if an object ihas type StateChangedEventArgs and all properties are equal.</returns>
		public override bool Equals(object obj)
		{
			bool isEqual = (null != obj);

			if (isEqual)
			{
				isEqual = (obj.GetType() == this.GetType());
			}

			ExecuteEventArgs theObject = obj as ExecuteEventArgs;

			if (isEqual)
			{
				isEqual = (this.Action.Equals(theObject.Action));
			}

			if (isEqual)
			{
				if (null == this.FileName)
				{
					isEqual = (this.FileName.Equals(theObject.FileName));
				}
				else
				{
					isEqual = (null == theObject.FileName);
				}
			}

			return isEqual;
		}

		/// <summary>
		/// Gets hash code (ToString - hash code).
		/// </summary>
		/// <returns>The hash code (ToString - hash code).</returns>
		public override int GetHashCode()
		{
			return ToString().GetHashCode();
		}

		/// <summary>
		/// Gets the text representation.
		/// </summary>
		/// <returns></returns>
		public override string ToString()
		{
			StringBuilder sb = new StringBuilder("ExecuteEventArgs");
			sb.AppendFormat("Action: {0}", Action.ToString());
			sb.AppendFormat("FileName: {0}", FileName.ToString());

			return sb.ToString();
		}
		#endregion EventArgs overrided methods

		#endregion Methods
	}
}
